<?php
class mlogin {


	public function try_login($meno,$priezvisko, $passwd) {
		$pass=md5($passwd).sha1($passwd);
		conndb::getInst()->query("SELECT * FROM rozhodca WHERE meno=\"$meno\" AND priezvisko=\"$priezvisko\" AND heslo=\"".$pass."\"");
		$possible_user = conndb::getInst()->getRowAsObject();
		if($possible_user == ""){
			conndb::getInst()->query("SELECT * FROM  organizator WHERE meno=\"$meno\" AND priezvisko=\"$priezvisko\" AND heslo=\"".$pass."\"");
			$possible_user = conndb::getInst()->getRowAsObject();
		}
		
		if($possible_user == "") {return false;}
		else {
			 $possible_user->Heslo = ''; 
			 $_SESSION['user'] = $possible_user;
			 return true;
			 
		}
	}
}	
?>